package com.ruoyi.zhgd.controller;

import cn.dev33.satoken.annotation.SaCheckLogin;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.zhgd.domain.vo.NAsphaltDayStatisticsVo;
import com.ruoyi.zhgd.service.NAsphaltDayStatisticsService;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * 全天数据分析
 *
 * @author tll
 * @date 2023-10-12
 */
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/zhgd/asphaltDayStatistics")
public class NAsphaltDayStatisticsController extends BaseController {

    private final NAsphaltDayStatisticsService nAsphaltDayStatisticsService;

    /**
     * 获取分页列表
     * @param params
     * @return
     */
    @SaCheckLogin
    @GetMapping("/getDayChartData")
    public R<NAsphaltDayStatisticsVo> getDayChartData(@RequestParam Map<String, Object> params) {
        if (ObjectUtils.isEmpty(params.get("matchCode")) || ObjectUtils.isEmpty(params.get("day"))) {
            return null;
        }
        String stationCode = null;
        String matchCode = params.get("matchCode").toString();
        String day = params.get("day").toString();
        return R.ok(nAsphaltDayStatisticsService.getDayChartData(stationCode, matchCode, day));
    }

}
